<?xml version="1.0" encoding="ISO-8859-2"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2"/>
            <title><h:outputText value="#{ind.title}"/></title>
            <link rel="stylesheet" type="text/css" href="style/main.css"/>
    </h:head>
    <h:body>
        <div id="header"><h1 id="title"><h:outputText value="#{ind.heading}"/></h1></div>
        <ui:include src="WEB-INF/util/menu.xhtml" />
        <p>Adding a new category of book</p>
        <center>
            <h:form>

                <rich:panel style="width:300px">
                    <f:facet name="header">
                        <h:outputText value="Adding category"/>
                    </f:facet>
                    <h:panelGrid columns="2">
                        <h:outputText value="Category:" />
                        <rich:inplaceInput defaultLabel="Click to enter your category" 
                               value="#{catBean.name}" required="true"/>
                        <h:outputText value="Master category for a new category:" />
                        <rich:autocomplete id="parentCat" mode="cachedAjax" minChars="2"
                               autocompleteMethod="#{autocompleteCategory.autocomplete}"
                               value="#{catBean.masterName}" required="false" 
                               validator="#{categoryValidator.validate}">
                        </rich:autocomplete>
                        <h:message for="parentCat" errorClass="errors"/>
                    </h:panelGrid>
                </rich:panel>
                
                <h:commandButton value="Add category" action="#{catService.create}"/>
            </h:form>
        </center>

        <ui:include src="WEB-INF/util/footer.xhtml" />
    </h:body>
</html>
